#ifndef __OBJECTFACTORY_H__
#define __OBJECTFACTORY_H__

#include <vector>
#include "Object.h"
#include "ObjectCreateStrategy.h"
#include "Model.h"

void static addObjTimer(struct args value);
void add_schedule(int timing, float x, float y, float z,  MODEL_TYPE mtype);
class ObjectFactory
{
private:
public:
	static void generateObjects(int time_interval)
	{
		//airplane, tank generate
		int airplane1_num = NumberStrategy::get_number(0, 1);
		int airplane2_num = NumberStrategy::get_number(0, 1);
		int tank_num = NumberStrategy::get_number(0, 1);

		std::cout<<airplane1_num<<" "<<airplane2_num<<" "<<tank_num<<std::endl;

		std::vector<std::vector<float>> a1_pos_vec = PositionStrategy::get_xyz(airplane1_num, 0.0, 4000.0, 500, 1000, -2200, -2000);
		std::vector<std::vector<float>> a2_pos_vec = PositionStrategy::get_xyz(airplane2_num, 0.0, 4000.0, 500, 1000, -2200, -2000);
		std::vector<std::vector<float>> tank_pos_vec = PositionStrategy::get_xyz(tank_num, 0.0, 4000.0, 100, 100, -2000, -2200);

		std::vector<int> timing_vec;
		timing_vec = TimingStrategy::getTiming(airplane1_num, time_interval);
		for(int i = 0 ; i < airplane1_num ; i++)
		{
			
			//std::cout<<timing_vec[i]<<" "<<a1_pos_vec[i][0]<<" "<<a1_pos_vec[i][1]<<" "<<a1_pos_vec[i][2]<<std::endl;
			add_schedule(timing_vec[i], a1_pos_vec[i][0]-2000, a1_pos_vec[i][1], a1_pos_vec[i][2], AIRCRAFT1);
		}
		
		timing_vec = TimingStrategy::getTiming(airplane2_num, time_interval);
		for(int i = 0 ; i < airplane2_num ; i++)
		{
			
			//std::cout<<timing_vec[i]<<" "<<a2_pos_vec[i][0]<<" "<<a2_pos_vec[i][1]<<" "<<a2_pos_vec[i][2]<<std::endl;
			add_schedule(timing_vec[i], a2_pos_vec[i][0]-2000, a2_pos_vec[i][1], a2_pos_vec[i][2], AIRCRAFT2);
		}

		timing_vec = TimingStrategy::getTiming(tank_num, time_interval);
		for(int i = 0 ; i < tank_num ; i++)
		{
			
			//std::cout<<timing_vec[i]<<" "<<tank_pos_vec[i][0]<<" "<<tank_pos_vec[i][1]<<" "<<tank_pos_vec[i][2]<<std::endl;
			add_schedule(timing_vec[i], tank_pos_vec[i][0]-2000, tank_pos_vec[i][1], tank_pos_vec[i][2], TANK_PROJECT);
		}
	}
};


#endif